package cn.iocoder.yudao.module.ems.mq.consumer.classification;

import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.iocoder.yudao.module.ems.mq.message.ClassificationRefreshMessage;
import cn.iocoder.yudao.module.ems.service.classification.ClassificationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 针对 {@link ClassificationRefreshMessage} 的消费者
 *
 * @author dason
 */
@Component
@Slf4j
public class ClassificationRefreshConsumer extends AbstractChannelMessageListener<ClassificationRefreshMessage> {

    @Resource
    private ClassificationService classificationService;

    @Override
    public void onMessage(ClassificationRefreshMessage message) {
        log.info("[onMessage][收到 Classification 刷新消息]");
        classificationService.initLocalCache();
    }

}
